package utils

import (
	"regexp"

	"github.com/go-playground/validator/v10"
)

// 用户相关的校验
func GloValidStr(reg string) func(fl validator.FieldLevel) bool {
	return func(fl validator.FieldLevel) bool {
		params := fl.Field().String()
		if match, _ := regexp.MatchString(reg, params); !match {
			return false
		} else {
			return true
		}
	}
}
